
#import "RIBIlluminate.h"

@implementation RIBIlluminate

+ initialize { return [RIBIlluminate setVersion:1], self; }

- init
{
  [super init];

  token = NULL;
  flag = 0;
  
  return self;
}

- setToken:(RtToken)newToken flag:(RtBoolean)newFlag
{
  token = newToken;
  flag = newFlag;

  return self;
}

- (RtToken)token { return token; }
- (RtBoolean)flag { return flag; }

- renderSelf:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime
{
  RiIlluminate(token, flag);

  return self;
}

- writeEve:(NXStream *)stream atTabLevel:(int)tab
{
   int  i;


   for (i = 0; i < tab; i++)
   {  NXPrintf(stream, "\t");
   }
   NXPrintf(stream, "Illuminate {%s} %d;", token, flag); 
   return self;
}

#define typeVector "*c"
#define typeValues &token, &flag

- read:(NXTypedStream*)stream 
{
    int version;
    [super read:stream];

    version = NXTypedStreamClassVersion(stream,"RIBIlluminate");
    if (version == 0) NXReadTypes(stream, "i", &version), version=1;
    if (version == 1)
    {  NXReadTypes(stream, typeVector, typeValues);
    } 
    else 
    {
    }
    return self;
}

- write:(NXTypedStream*)stream 
{
    [super write:stream];

    NXWriteTypes(stream, typeVector, typeValues);

    return self;
}

@end
